package com.longge;

public class HasGroupsSizeX {

    public boolean hasGroupsSizeX(int[] deck) {

        int[] count = new int[10000];
        for (int c : deck) {
            count[c]++;
        }

        int g = -1;

        for (int i : count) {
            if (i != 0) {
                if (g == -1) {
                    g = i;
                } else {
                    g = gcd(g, i);
                }
            }
        }
        return g>=2;

    }


    public int gcd(int x, int y) {
        return x == 0 ? y : gcd(y % x, x);
    }

    public static void main(String[] args) {
        int gcd = new HasGroupsSizeX().gcd(12, 17);
        System.out.println(gcd);
    }


}
